%%{init: {'themeVariables': { 'fontSize': '12px'}}}%%
graph TD
    classDef path fill:#eee,stroke:#000,color:#000
    classDef plan fill:#fff,stroke-width:1px,color:#000
    classDef itemplan fill:#fff,stroke-width:2px,color:#000
    classDef unbatchedplan fill:#dff,stroke-width:1px,color:#000
    classDef sideeffectplan fill:#fcc,stroke-width:2px,color:#000
    classDef bucket fill:#f6f6f6,color:#000,stroke-width:2px,text-align:left

    subgraph "Buckets for queries/functions/custom-query-user"
    Bucket0("Bucket 0 (root)<br /><br />1: <br />ᐳ: Access[7], Access[8], Object[9]<br />2: PgSelect[6]<br />3: PgSelectRows[11]<br />ᐳ: First[10], PgSelectSingle[12]"):::bucket
    Bucket1("Bucket 1 (nullableBoundary)<br />Deps: 12<br /><br />ROOT PgSelectSingleᐸusersᐳ[12]"):::bucket
    end
    Bucket0 --> Bucket1

    %% plan dependencies
    Object9{{"Object[9∈0] ➊<br />ᐸ{pgSettings,withPgClient}ᐳ"}}:::plan
    Access7{{"Access[7∈0] ➊<br />ᐸ2.pgSettingsᐳ"}}:::plan
    Access8{{"Access[8∈0] ➊<br />ᐸ2.withPgClientᐳ"}}:::plan
    Access7 & Access8 --> Object9
    PgSelect6[["PgSelect[6∈0] ➊<br />ᐸrandom_userᐳ"]]:::plan
    Object9 --> PgSelect6
    __Value2["__Value[2∈0] ➊<br />ᐸcontextᐳ"]:::plan
    __Value2 --> Access7
    __Value2 --> Access8
    First10{{"First[10∈0] ➊"}}:::plan
    PgSelectRows11[["PgSelectRows[11∈0] ➊"]]:::plan
    PgSelectRows11 --> First10
    PgSelect6 --> PgSelectRows11
    PgSelectSingle12{{"PgSelectSingle[12∈0] ➊<br />ᐸusersᐳ"}}:::plan
    First10 --> PgSelectSingle12
    PgClassExpression13{{"PgClassExpression[13∈1] ➊<br />ᐸ__random_u...”username”ᐳ"}}:::plan
    PgSelectSingle12 --> PgClassExpression13
    PgClassExpression14{{"PgClassExpression[14∈1] ➊<br />ᐸ__random_u...vatar_url”ᐳ"}}:::plan
    PgClassExpression13 o--o PgClassExpression14

    %% define steps
    classDef bucket0 stroke:#696969
    class Bucket0,__Value2,PgSelect6,Access7,Access8,Object9,First10,PgSelectRows11,PgSelectSingle12 bucket0
    classDef bucket1 stroke:#00bfff
    class Bucket1,PgClassExpression13,PgClassExpression14 bucket1

